import { dictionaryQueryListByName, settingsQueryList } from "@/api/useDataGrid";

export default {
  data() {
    return {
      addFormApi: {
        type: {
          api: settingsQueryList,
          params: {
            "type": "ngType"
          },
          options: []
        },
        modelType: {
          api: dictionaryQueryListByName,
          data: {
            "name": "modelType",
            "status": 0
          },
          options: []
        }
      },
      //
      formProperty: {
        visible: false,
        formAttrs: {
          "label-width": "110px",
          inline: true
        },
        title: ["编辑不良品处理方式", "新增不良品处理方式"],
        formType: "add",
        options: [
          {
            type: "select",
            value: "",
            label: "产品类型",
            prop: "modelType",
            backfill: true,
            attrs: {
              placeholder: "请选择产品类型",
              style: {
                width: "200px"
              }
            },
            rules: [
              {
                required: true,
                message: "请选择产品类型",
                trigger: "blur"
              }
            ],
            childern: []
          },

          {
            type: "select",
            value: "",
            label: "不良类型",
            backfill: true,
            prop: "type",
            attrs: {
              placeholder: "请选择不良类型",
              style: {
                width: "200px"
              }
            },
            rules: [
              {
                required: true,
                message: "请选择不良类型",
                trigger: "blur"
              }
            ],
            childern: []
          },
          {
            type: "input",
            value: "",
            label: "不良类型名称",
            prop: "name",
            attrs: {
              placeholder: "请输入不良类型名称",
              style: {
                width: "200px"

              }
            },
            rules: [
              {
                required: true,
                message: "请输入不良类型名称",
                trigger: "blur"
              }
            ]
          },
          {
            type: "input",
            value: "",
            label: "备注",
            prop: "remark",
            attrs: {
              type: "textarea",
              style: {
                width: "200px"
              }
            }
          }
        ]
      }
    };
  },
  methods: {
    saveForm(formData) {
      console.log(formData, "表单提交");
      this.formProperty.visible = false;
      // formData.fun();
    }

  }
};
